<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link type="text/css" rel="stylesheet" href="css/personal.css"/>
    <script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
    <script type="text/javascript" src="js/personal.js"></script>
    <title>个人中心-我的职位</title>
    <script type="text/javascript" src="js/jquery-1.8.3.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var eid;
            var pid;
            var uid = localStorage.getItem("uid");
            // var pageNum = localStorage.getItem("pageNum");
            var apply="已申请";
            $.get("Posts/selectbystatus", {"uid": uid}, function (pageInfo) {
                var EntAndPosts = pageInfo.list;
                $("#page1").text("共"+pageInfo.pages+"页   第"+pageInfo.pageNum+"/"+pageInfo.pages+"页");
                $("#page").text("共"+pageInfo.pages+"页   第"+pageInfo.pageNum+"/"+pageInfo.pages+"页");
                forlis(EntAndPosts);
                $("[class = 'fenyediv']").empty();
                if(pageInfo.pageNum!=1){
                    $("<a name='"+1+"' class='fy1'>首页</a>").appendTo("[class = 'fenyediv']");
                    $("<a name='"+pageInfo.prePage+"' class='fy1'>上一页</a>").appendTo("[class = 'fenyediv']");
                }
                if(pageInfo.pageNum!=pageInfo.pages){
                    $("<a name='"+pageInfo.nextPage+"' class='fy1'>下一页</a>").appendTo("[class = 'fenyediv']");
                    $("<a name='"+pageInfo.pages+"' class='fy1'>尾页</a>").appendTo("[class = 'fenyediv']");
                }
            });
            $("[name='sousuo']").click(function () {
                selectlike();
            });
            $(document).on("click", "a[title='申请']", function () {
                var apply="立即申请";
                var gid=$(this).attr("name");
                $.get("Posts/update1",{"uid":uid,"apply":apply,"gid":gid},function (up) {
                    window.location.href="http://127.0.0.1:8080/personal_selected.html";
                });


            });

            $("#dianspan").click(function () {
                var gid=$(this).attr("name");
                var concern="关注";
                $.get("Posts/update2",{"uid":uid,"concern":concern,"gid":gid},function (up) {
                    window.location.href="http://127.0.0.1:8080/personal_selected.html";
                });
            });

            /**
             * 给搜索页面每一行左边的职位关键词添加单击事件，单击进入职位详细信息页面，用过获取当前行的职位名称等信息，传回后台查询结果已封装类的形式传回职位招聘详细页面
             */
            $(document).on("click","[class='jobname']",function () {
                //upe
                var eid=$(this).attr("name");
                localStorage.setItem("eid",eid);
                var pid=$(this).attr("id");
                localStorage.setItem("pid",pid);
                window.location.href = "http://127.0.0.1:8080/job_info.html";
            });

            /**
             *给搜索页面每一行左边的企业名称关键词添加单击事件，单击进入职位详细信息页面，用过获取当前行的职位名称等信息，传回后台查询结果已封装类的形式传回公司介绍页面
             */
            $(document).on("click","#company",function () {
                //ue
                var eid=$(this).attr("name");
                localStorage.setItem("eid",eid);
                window.location.href = "http://127.0.0.1:8080/company.html";
            });


            $(document).on("click", "[class='fy1']", function () {
                var pname1 =$("[name='pname']").val();
                var indexpage =$(this).attr("name");
                $.get("Posts/selectlike",{"pname":pname1,"uid":uid,"apply":apply,"indexpage":indexpage},function (pageInfo) {
                    var list =pageInfo.list;
                    forlis(list);
                    $("#page1").text("共"+pageInfo.pages+"页   第"+pageInfo.pageNum+"/"+pageInfo.pages+"页");
                    $("#page").text("共"+pageInfo.pages+"页   第"+pageInfo.pageNum+"/"+pageInfo.pages+"页");
                    forbuf(pageInfo);
                });
            });
            $(document).on("click", "[class='fy2']", function () {
                var pname1 =$("[name='pname']").val();
                var indexpage =$(this).attr("name");
                $.get("Posts/selectlike",{"pname":pname1,"uid":uid,"apply":apply,"indexpage":indexpage},function (pageInfo) {
                    var list = pageInfo.list;
                    forlis(list);
                    $("#page1").text("共" + pageInfo.pages + "页   第" + pageInfo.pageNum + "/" + pageInfo.pages + "页");
                    $("#page").text("共" + pageInfo.pages + "页   第" + pageInfo.pageNum + "/" + pageInfo.pages + "页");
                    forbuf(pageInfo);
                });
            });

            function selectlike() {

                $(document).ready(function () {
                    var pname=$("[name='wenben']").val();

                    $.get("Posts/selectlike",{"uid":uid,"apply":apply,"pname":pname},function (liss) {
                        var EntAndPosts=liss.list;
                        forlis(EntAndPosts);
                    });
                });
            }
            function forbuf(pageInfo) {
                alert("进入分页");
                alert(pageInfo.pageNum);
                $("[class = 'fenyediv']").empty();
                if(pageInfo.pageNum!=1){
                    $("<a name='"+1+"' class='fy1'>首页</a>").appendTo("[class = 'fenyediv']");
                    $("<a name='"+pageInfo.prePage+"' class='fy1'>上一页</a>").appendTo("[class = 'fenyediv']");
                }
                if(pageInfo.pageNum!=pageInfo.pages){
                    $("<a name='"+pageInfo.nextPage+"' class='fy1'>下一页</a>").appendTo("[class = 'fenyediv']");
                    $("<a name='"+pageInfo.pages+"' class='fy1'>尾页</a>").appendTo("[class = 'fenyediv']");
                }
            }
        });

        function forlis(EntAndPosts) {
            $("tbody").empty();
            for (var i = 0; i < EntAndPosts.length; i++) {
                $("<tr >\n" +
                    "                            <td>\n" +
                    "                                <a name='"+EntAndPosts[i].eid+"' id='"+EntAndPosts[i].pid+"' class=\"jobname\">'"+EntAndPosts[i].pname+"'</a>\n" +
                    "                            </td>\n" +
                    "                            <td>\n" +
                    "                                <div class=\"company\">\n" +
                    "                                    <a id='company' name='"+EntAndPosts[i].eid+"'>'"+EntAndPosts[i].business+"'</a>\n" +
                    "                                </div>\n" +
                    "                            </td>\n" +
                    "                            <td></td>\n" +
                    "                            <td>'"+EntAndPosts[i].local+"'</td>\n" +
                    "                            <td><span>'"+EntAndPosts[i].sal+"'</span></td>\n" +
                    "                            <td>'"+EntAndPosts[i].lasttime+"'</td>\n" +
                    "                        </tr>\n" +
                    "                        <tr class=\"xxdetail none\">\n" +
                    "                            <td colspan=\"5\">\n" +
                    "                                <div class=\"yaoqiu\">学历要求：'"+EntAndPosts[i].degree+"' | 工作经验：'"+EntAndPosts[i].workexperience+"' | 公司规模：'"+EntAndPosts[i].scale+"' | 招聘方式：'"+EntAndPosts[i].recruittype+"'<br/>\n" +
                    "                                    岗位职责：'"+EntAndPosts[i].pduty+"'\n" +
                    "                                    <br/>\n" +
                    "                                    岗位要求：'"+EntAndPosts[i].jrequest+"'\n" +
                    "                                </div>\n" +
                    "                            </td>\n" +
                    "                            <td>\n" +
                    "                                <div class=\"applydiv\">\n" +
                    "                                    <a href=\"javascript:void(0);\" class=\"ysqbtn\" name='"+EntAndPosts[i].gid+"' title='申请'>'"+EntAndPosts[i].apply+"'</a>\n" +
                    "                                    <span id='dianspan' class=\"ygz\">'"+EntAndPosts[i].concern+"'</span>\n" +
                    "                                </div>\n" +
                    "                            </td>\n" +
                    "                        </tr>").appendTo("tbody");
            }
        }
        $(document).on("click","[class='fy1']",function () {
            var post1=$("#input").val();
            var pageNum =$(this).attr("name");
            localStorage.setItem("pageNum",pageNum);
            window.location.href="searchjob.html";
        });
        /**
         * 按关键词搜索
         */
        $("#search").click(function () {
            var post1=$("#input").val();
            localStorage.setItem("pname",post1);
            window.location = "searchJob.html";

        });
    </script>
</head>

<body>
<div class="header">
    <div class="headerMain">
        <div class="Notice">
        </div>
        <div class="Account">
            <div class="Left">
                <div class="Info">
                    <font>退出</font>
                    <input type="button">
                    <div id="InfoPopup">
                        <ul>
                            <li><a href="index.html">退出</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="navTop">
    <div class="navTopmain">
        <div class="logo"><a><img src="images/logo_1.png"/><img src="images/logo_2.png"/></a></div>
        <div class="nav">
        </div>
    </div>
</div>
<div class="personalBody">
    <div class="perRightcon">
        <div class="commonTit">
            <h1 class="fl">职位搜索</h1>
        </div>
        <div class="clear"></div>
        <div class="zwssPart1">
            <div class="zxssPart1_1">
                <input id="input" name="wenben" type="text" placeholder="请填写关键词"/>
            </div>
            <div class="zxssPart1_4">
                <input id="search" name="sousuo" type="button" value="搜工作"/>
            </div>
        </div>
        <div class="clear"></div>
        <div class="zwssPart3">
            <div class="seachlist">
                <div class="listtop">
                    <div class="tj1">
                        <span id="list" class="list on">列表</span>
                        <span id="little" class="zhaoyao">摘要</span>
                    </div>
                    <div class="tj3">
                        <span id="page1">共1141条  第1/39页</span>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="listcon">
                    <table border="0" width="100%" cellpadding="0" cellspacing="0" class="listtab">
                        <thead>
                        <tr>
                            <th width="24%" style="padding-left:17px">职位名称</th>
                            <th width="30%">企业名称</th>
                            <th width="9%"></th>
                            <th width="16%">工作地点</th>
                            <th width="8%">薪水</th>
                            <th width="9%">刷新时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>
                <div class="clear"></div>
                <div class="listbottom">
                    <div class="lb3" id="page"><span>共1141条  第1/39页</span></div>
                </div>
                <div class="clear"></div>
                <div class="fenyediv">
                    <a href="javascript:void(0)" class="fy1">首页</a>
                    <a href="javascript:void(0)" class="fy1">上一页</a>
                    <a href="javascript:void(0)" class="fy2 on">1</a>
                    <a href="javascript:void(0)" class="fy2">2</a>
                    <a href="javascript:void(0)" class="fy2">3</a>
                    <a href="javascript:void(0)" class="fy2">4</a>
                    <a href="javascript:void(0)" class="fy2">5</a>
                    <a href="javascript:void(0)" class="fy2">6</a>
                    <a href="javascript:void(0)" class="fy2">7</a>
                    <a href="javascript:void(0)" class="fy2">8</a>
                    <a href="javascript:void(0)" class="fy2">9</a>
                    <a href="javascript:void(0)" class="fy2">10</a>
                    <a href="javascript:void(0)" class="fy1">下一页</a>
                    <a href="javascript:void(0)" class="fy1">尾页</a>
                </div>
                <div class="clear"></div>
            </div>
        </div>
    </div>
</div>


<div class="clear"></div>
<div class="footer">
</div>
</body>
</html>
